package ch09;

class _11_StringEx3 {
	public static void main(String[] args) {
		String s1 = "AAA";
		String s2 = new String("AAA");	
		System.out.println(s1 == s2); // false
		System.out.println(System.identityHashCode(s1)); // 266478922
		System.out.println(System.identityHashCode(s2)); // 1207838059

		s2 = s2.intern();		
		System.out.println(s1 == s2);  // true
		System.out.println(System.identityHashCode(s1)); // 266478922
		System.out.println(System.identityHashCode(s2)); // 266478922
	}
}